package com.itheima.d4_print_stream;

import java.io.FileNotFoundException;
import java.io.PrintStream;

/*
  目标：了解下输出语句的重定向。
 */
public class PrintTest2 {
    public static void main(String[] args) {
        try {
            PrintStream ps = new PrintStream("error.txt");
            System.setOut(ps);
            int[] arr = {1,2,3};
            System.out.println(arr[5]);
        } catch (Exception e) {
            System.out.println(e);
            System.out.println("sldkjfwoieow4i");
            System.out.println("到偶尔日");
        }
    }

}
